key_id = (len > 16) ? fingerprint + len - 16 : fingerprint;
date_time_utc = g_date_time_new_from_unix_utc (timestamp);
+ if (date_time_utc == NULL)
+ {
+ g_string_append_printf (output_buffer,
+ "Can't check signature: timestamp %" G_GINT64_FORMAT " is invalid\n",
+ timestamp);
+ return;
+ }
+
date_time_local = g_date_time_to_local (date_time_utc);
formatted_date_time = g_date_time_format (date_time_local, "%c");
if (exp_timestamp > 0)
{
date_time_utc = g_date_time_new_from_unix_utc (exp_timestamp);
+ if (date_time_utc == NULL)
+ {
+ g_string_append_printf (output_buffer,
+ "Signature expiry timestamp (%" G_GINT64_FORMAT ") is invalid\n",
+ exp_timestamp);
+ return;
+ }
+
date_time_local = g_date_time_to_local (date_time_utc);
formatted_date_time = g_date_time_format (date_time_local, "%c");
g_autofree char *old_ts_str = NULL;
g_autofree char *new_ts_str = NULL;
- g_assert (old_ts);
- g_assert (new_ts);
+ if (old_ts == NULL || new_ts == NULL)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Upgrade target revision '%s' timestamp (%" G_GINT64_FORMAT ") or current revision '%s' timestamp (%" G_GINT64_FORMAT ") is invalid",
+ to_rev, ostree_commit_get_timestamp (new_commit),
+ from_rev, ostree_commit_get_timestamp (old_commit));
+ goto out;
+ }
+
old_ts_str = g_date_time_format (old_ts, "%c");
new_ts_str = g_date_time_format (new_ts, "%c");
g_date_time_unref (old_ts);
while (ot_parse_cookies_next (parser))
{
g_autoptr(GDateTime) expires = g_date_time_new_from_unix_utc (parser->expiration);
- g_autofree char *expires_str = g_date_time_format (expires, "%Y-%m-%d %H:%M:%S +0000");
+ g_autofree char *expires_str = NULL;
+
+ if (expires != NULL)
+ expires_str = g_date_time_format (expires, "%Y-%m-%d %H:%M:%S +0000");
g_print ("--\n");
g_print ("Domain: %s\n", parser->domain);
g_print ("Path: %s\n", parser->path);
g_print ("Name: %s\n", parser->name);
g_print ("Secure: %s\n", parser->secure);
- g_print ("Expires: %s\n", expires_str);
+ if (expires_str != NULL)
+ g_print ("Expires: %s\n", expires_str);
g_print ("Value: %s\n", parser->value);
}
#else